package org.example.software.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.software.entity.DTO.UserForum;
import org.example.software.entity.User;
import org.example.software.entity.VO.UserInfo;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("SELECT id, name, age, gender, email, grade FROM user WHERE id=#{id}")
    UserInfo getUserInfoById(String id);

    @Select("SELECT name FROM user WHERE id=#{id}")
    String getUserNameById(String id);

    @Select("SELECT COUNT(*) FROM user WHERE name = #{name}")
    int userNameExists(String name);
}
